package org.ksoap2.transport;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import okhttp3.OkHttpClient;
import okhttp3.internal.huc.OkHttpURLConnection;
import org.ksoap2.HeaderProperty;

/* loaded from: classes2.dex */
public class OkHttpServiceConnectionSE implements ServiceConnection {
    private OkHttpClient client;
    private HttpURLConnection connection;

    public OkHttpServiceConnectionSE(String str) throws IOException {
        this(null, str, ServiceConnection.DEFAULT_TIMEOUT);
    }

    public OkHttpServiceConnectionSE(Proxy proxy, String str) throws IOException {
        this(proxy, str, ServiceConnection.DEFAULT_TIMEOUT);
    }

    public OkHttpServiceConnectionSE(String str, int i) throws IOException {
        this(null, str, i);
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public OkHttpServiceConnectionSE(java.net.Proxy r5, java.lang.String r6, int r7) throws java.io.IOException {
        /*
            r4 = this;
            okhttp3.OkHttpClient$Builder r0 = new okhttp3.OkHttpClient$Builder
            r0.<init>()
            long r1 = (long) r7
            java.util.concurrent.TimeUnit r3 = java.util.concurrent.TimeUnit.MILLISECONDS
            okhttp3.OkHttpClient$Builder r0 = r0.connectTimeout(r1, r3)
            java.util.concurrent.TimeUnit r3 = java.util.concurrent.TimeUnit.MILLISECONDS
            okhttp3.OkHttpClient$Builder r0 = r0.readTimeout(r1, r3)
            okhttp3.OkHttpClient r0 = r0.build()
            r4.<init>(r0, r5, r6, r7)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: org.ksoap2.transport.OkHttpServiceConnectionSE.<init>(java.net.Proxy, java.lang.String, int):void");
    }

    public OkHttpServiceConnectionSE(OkHttpClient okHttpClient, Proxy proxy, String str, int i) throws IOException {
        this.client = okHttpClient;
        OkHttpURLConnection okHttpURLConnection = new OkHttpURLConnection(new URL(str), okHttpClient);
        this.connection = okHttpURLConnection;
        okHttpURLConnection.setUseCaches(false);
        this.connection.setDoOutput(true);
        this.connection.setDoInput(true);
        this.connection.setConnectTimeout(i);
        this.connection.setReadTimeout(i);
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public void connect() throws IOException {
        this.connection.connect();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public void disconnect() {
        this.connection.disconnect();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public List getResponseProperties() throws IOException {
        LinkedList linkedList = new LinkedList();
        Map<String, List<String>> headerFields = this.connection.getHeaderFields();
        if (headerFields != null) {
            for (String str : headerFields.keySet()) {
                List<String> list = headerFields.get(str);
                for (int i = 0; i < list.size(); i++) {
                    linkedList.add(new HeaderProperty(str, list.get(i)));
                }
            }
        }
        return linkedList;
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public int getResponseCode() throws IOException {
        return this.connection.getResponseCode();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public void setRequestProperty(String str, String str2) {
        this.connection.setRequestProperty(str, str2);
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public void setRequestMethod(String str) throws IOException {
        this.connection.setRequestMethod(str);
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public void setFixedLengthStreamingMode(int i) {
        this.connection.setFixedLengthStreamingMode(i);
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public void setChunkedStreamingMode() {
        this.connection.setChunkedStreamingMode(0);
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public OutputStream openOutputStream() throws IOException {
        return this.connection.getOutputStream();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public InputStream openInputStream() throws IOException {
        return this.connection.getInputStream();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public InputStream getErrorStream() {
        return this.connection.getErrorStream();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public String getHost() {
        return this.connection.getURL().getHost();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public int getPort() {
        return this.connection.getURL().getPort();
    }

    @Override // org.ksoap2.transport.ServiceConnection
    public String getPath() {
        return this.connection.getURL().getPath();
    }
}
